version: '2.0'

services:

  prometheus:
    image: prom/prometheus:latest
    volumes:
      - ./prometheus/:/etc/prometheus/:rw
      - ./prometheus/data:/prometheus:rw
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--storage.tsdb.retention.time={{ monitor_retention_time }}'
      - '--storage.tsdb.retention.size={{ monitor_retention_size }}'
      - '--web.console.libraries=/usr/share/prometheus/console_libraries'
      - '--web.console.templates=/usr/share/prometheus/consoles'
      - '--web.listen-address=:{{ prometheus_listen_port }}'
    network_mode: host

  grafana:
    image: grafana/grafana
    depends_on:
      - prometheus
    network_mode: host
    volumes:
      - ./grafana/data:/var/lib/grafana:rw
      - ./grafana/grafana.ini:/etc/grafana/grafana.ini:rw
    environment:
      - GF_INSTALL_PLUGINS=grafana-piechart-panel
      - GF_SECURITY_ADMIN_USER={{ grafana_username }}
      - GF_SECURITY_ADMIN_PASSWORD={{ grafana_password }}

  reporter:
    image: promoon/reporter:latest
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - ./grafana/report:/tmp/report:rw
    network_mode: host
